<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue指令3</title>
    <script src="./js/vue.js"></script>
</head>
<body>
    <div id="add1">
        <!-- if-else if-else -->
        请输入年龄:&nbsp;<input type="text" v-model="age"><br>
        经判断为:
        <span v-if="age <= 35">年轻人</span>
        <span v-else-if="age <= 60">中年人</span>
        <span v-else>老年人</span>
        <hr>
        <!-- show -->
        经判断为:
        <span v-show="age <= 35">年轻人</span>
        <span v-show="age <= 60 && age > 35">中年人</span>
        <span v-show="age > 60">老年人</span>
    </div>
    <div id="add2">
        <div v-for="addr in addrs">{{addr}}</div>
        <div v-for="(addr1,index) in addrs">{{index}}:{{addr1}}</div>
    </div>
</body>
<script>
    //v-if v-show
    new Vue({
        el:"#add1",
        data:{
            age:20
        }
    })
    //v-for
    new Vue({
        el: "#app", //vue接管区域
        data:{
           addrs:["北京", "上海", "西安", "成都", "深圳"]
        },
        methods: {
            
        }
    })
</script>
</html>